package com.sentinel.client.mvc.web;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping(value = "demo")
public class DemoController {

    @SentinelResource(value = "get", blockHandler = "flowBlockHandler")
    @GetMapping(value = "get")
    public String get() throws InterruptedException {
        Thread.sleep(5000);
        return ("获取时间戳:" + new Date().getTime());
    }
}